MonthlyExpenses= 400+75+100;
MonthlyIncome = 1000;
InterestRate = .02
// compute the amount Julien will have saved after one year
Total = 0;
InterestEarned =0;
for x = 1 to 12 InterestEarned = Total * InterestRate; Total = Total + InterestEarned + MonthlyIncome - MonthlyExpenses
next x;
Problem solving sequence:
1.Algorithm
2.Pseudo-code
3.Flowchat
4.C/C++ code
How much money has Julien? Julien spends £400 a month on rent, £75 a month on food, and £100 a month on other expenses. He earns 2% per month on any saving money.
Loop (for)
Example (Step 2)
Now there is one control statement that is inside of another control statement. This is known as nesting.